package io.renren.com.qywt.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.commons.mybatis.service.impl.CrudServiceImpl;
import io.renren.com.qywt.dao.AftersaleSupplierDao;
import io.renren.com.qywt.dto.AftersaleSupplierDTO;
import io.renren.com.qywt.entity.AftersaleSupplierEntity;
import io.renren.com.qywt.service.AftersaleSupplierService;
import io.renren.commons.security.context.TenantContext;
import io.renren.commons.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 供应商信息表
 *
 * @author jiaohj 15110414840@139.com
 * @since 3.0 2022-11-12
 */
@Service
public class AftersaleSupplierServiceImpl extends CrudServiceImpl<AftersaleSupplierDao, AftersaleSupplierEntity, AftersaleSupplierDTO> implements AftersaleSupplierService {

    @Override
    public QueryWrapper<AftersaleSupplierEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<AftersaleSupplierEntity> wrapper = new QueryWrapper<>();

        String shortName = (String)params.get("shortName");
        wrapper.like(StringUtils.isNotBlank(shortName), "short_name", shortName);
        String shopType = (String)params.get("shopType");
        wrapper.eq(StringUtils.isNotBlank(shopType), "shop_type", shopType);
        String platformType = (String)params.get("platformType");
        wrapper.eq(StringUtils.isNotBlank(platformType), "platform_type", platformType);
        String activeFlag = (String)params.get("activeFlag");
        wrapper.eq(StringUtils.isNotBlank(activeFlag), "active_flag", activeFlag);
        wrapper.eq("tenant_code", TenantContext.getTenantCode(SecurityUser.getUser()));

        return wrapper;
    }


}